{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class '__main__.N'>\n",
      "<class '__main__.B3'>\n",
      "<class '__main__.C3'>\n",
      "<class '__main__.B2'>\n",
      "<class '__main__.B1'>\n",
      "<class '__main__.B'>\n",
      "<class '__main__.C2'>\n",
      "<class '__main__.C1'>\n",
      "<class '__main__.C'>\n",
      "<class '__main__.D3'>\n",
      "<class '__main__.D2'>\n",
      "<class '__main__.D1'>\n",
      "<class '__main__.D'>\n",
      "<class '__main__.A'>\n",
      "<class 'object'>\n"
     ]
    }
   ],
   "source": [
    "class A(object):\n",
    "    pass\n",
    "    \n",
    "class B(A):\n",
    "    pass\n",
    "    \n",
    "class C(A):\n",
    "    pass\n",
    "    \n",
    "class D(A):\n",
    "    pass\n",
    "    \n",
    "\n",
    "class C1(C,D):\n",
    "    pass\n",
    "\n",
    "class B1(B,C1):\n",
    "    pass\n",
    "        \n",
    "class D1(D):\n",
    "    pass\n",
    "\n",
    "    \n",
    "class B2(B1):\n",
    "    pass\n",
    "    \n",
    "class C2(C1):\n",
    "    pass\n",
    "    \n",
    "class D2(D1):\n",
    "    pass\n",
    "\n",
    "    \n",
    "class B3(B2):\n",
    "    pass\n",
    "    \n",
    "class C3(B2,C2):\n",
    "    pass\n",
    "    \n",
    "class D3(D2):\n",
    "    pass\n",
    "    \n",
    "class N(B3,C3,D3):\n",
    "    pass\n",
    "\n",
    "for n in N.__mro__:\n",
    "    print(n)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "123是一种动物\n",
      "['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'classification', 'eat', 'run']\n"
     ]
    }
   ],
   "source": [
    "class Animal():\n",
    "     \n",
    "    def __init__(self,classification):\n",
    "        self.classification = classification\n",
    "        print(f'{self.classification}是一种动物')\n",
    "        \n",
    "    def run(self):\n",
    "        print('动物善于奔跑')\n",
    "        \n",
    "    def eat(self):\n",
    "        print('动物需要获得食物')\n",
    "        \n",
    "class Lion_Monster(Animal):\n",
    "    pass\n",
    "\n",
    "lion_monster = Lion_Monster('123')\n",
    "print(dir(lion_monster))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def f(N):\n",
    "    for class in N.fclass:   #fclass代表所以父类，slcass为父类的子类\n",
    "        if class = object:\n",
    "            \n",
    "        elif len(class.fclass.sclass) == 1: #N的父类没有其他兄弟类\n",
    "            class marked  #标记回溯过的类\n",
    "            f(class)\n",
    "        else:\n",
    "            \n",
    "    \n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
